{block name=body} 
{* Define the function *} 
{function name=render_files_list level=0} 
	{foreach $items as $item}
		<tr>
			<td>{for $var=1 to $level}- {/for}{if $item.files_created|date_format:"%Y%m%d" gte "-1 months"|date_format:"%Y%m%d"}<span class="new-badge">新建</span>{/if}{$item.files_friendly_name} </td>
			<td>
			{if $item.files_external_link} 
				<a href="{$item.files_external_link}" target="_blank" class="btn btn-small btn-info pull-right"><span class="glyphicon glyphicon-eye-open"></span> 查看</a> 
			{else}
				{if $item.files_path} 
					<a href="{$item.files_path}" target="_blank" class="btn btn-small btn-info pull-right"><span class="glyphicon glyphicon-download"></span> 下载</a> 
				{/if}
			{/if}
			</td>
			<td></td>
		</tr>
	{/foreach} 
{/function}

{function name=render_list level=0} 
	{foreach $items as $item}
		{if $item.url}
		<tr {if $item.published eq '0'}class="draft"{/if}>
			<td>{for $var=1 to $level}- {/for}<b>{$item.title} </b>{if $item.published eq '0'}<small>| 草稿</small>{/if}</td>
			
			<td>{if $item.url} <a href='{$item.url}' class='btn btn-small btn-warning pull-right'><span class="glyphicon glyphicon-pencil"></span> 编辑</a> {/if}
			</td>
			<td>{if $item.url_delete && $level gt 0} <a href='{$item.url_delete}' onclick="return ConfirmDelete();" class='btn btn-small btn-danger pull-right'><span class="glyphicon glyphicon-trash"></span> 删除</a> {/if}
			</td>
		</tr>
		{/if}
		{if $item.files} {call name=render_files_list items=$item.files level=$level+1} {/if} 
		{if count($item.subs) > 0} {call name=render_list items=$item.subs level=$level+1} {/if} 
	{/foreach} 
{/function}

<div class="row ">
	<table class="table table-bordered table-striped table-hover">
		<thead>
			<tr>
				<th colspan="3">{$zone|upper} <a href="/admin/edit/{$path}" class='btn btn-small btn-success pull-right'><span class="glyphicon glyphicon-plus"></span> 添加资源</a></th>
			</tr>
		</thead>
		<tbody>{call name=render_list items=$list}
		</tbody>
	</table>
</div>
{/block}
